home *** CD-ROM | disk | FTP | other *** search
- Path: Rezonet.net!news
- From: ray@ultimate-tech.com (Ray Dunn)
- Newsgroups: comp.lang.c
- Subject: Re: qsort Getting Warnings
- Date: 26 Jan 1996 19:49:09 GMT
- Organization: Ultimate Technographics Inc.
- Message-ID: <4ebb7l$r0c@ns.RezoNet.NET>
- References: <3107D58D.40D1@email.mot.com>
- NNTP-Posting-Host: 204.19.230.7
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=US-ASCII
- X-Newsreader: WinVN 0.99.7
-
- In referenced article, Mark Seaborn says...
- >Can someone send me an example of how to call qsort() located in
- >stdlib.h so I don't get warnings. The man page is just not cutting it
- >for me.
- >
- >qsort((void*)summary[i].sortedList, (size_t)numberOfExamples,
- > sizeof(float), attribCompare);
- >
- >now summary[i].sortedList is a pointer to an array of floats of size
- >numberOfExamples attribCompare is just a function that returns an
- >integer. The program works but I hate warnings. Any ideas would be
- >helpful.
-
- It would have helped if you'd posted the warning.
-
- There is no need to cast the first argument to (void *), but that won't
- create a warning.
-
- I wouldn't cast the second argument, so that if the type of
- numberOfExamples is "bigger" than size_t, then I'd like to see a
- warning.
-
- How is attribCompare declared? It should be a function of two const
- void pointer args returning an int.
- --
- Ray Dunn (opinions are my own) | Phone: (514) 938 9050
- Montreal | Phax : (514) 938 5225
- ray@ultimate-tech.com | Home : (514) 630 3749
-
-